package com.gmall.rabbitmq.consumer.service;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = {"Queue_Topic_1","Queue_Topic_2"},concurrency = "1")
public class RabbitMQServive_Topic {

    @RabbitHandler
    public void receive_SimpleMessage1(Channel channal, Message message,String msg){
        String consumerQueue = message.getMessageProperties().getConsumerQueue();
        System.out.println("------"+ consumerQueue +" String Start-------");
        System.out.println("MessageID:"+message.getMessageProperties().getMessageId());
        System.out.println("MessageBody:"+new String(message.getBody()));
        System.out.println("msg:"+msg);
        System.out.println("------"+ consumerQueue +" String END-------");
    }


}
